import {ARR_METHODS} from './config'
import observeArr from './observeArr'
let originArrMethods = Array.prototype,
    arrMethods = Object.create(originArrMethods)
ARR_METHODS.map((name) => {
    arrMethods[name] = function () {
        console.log('我是this')
        console.log(this)
        let args = Array.prototype.slice.call(arguments),
            rt = originArrMethods[name].call(this, args)
        let newArr
        switch (name) {
            case "push":
            case "shift":
                newArr = args
                break
            case "slice":
                newArr = args.slice[2]
                break
            default:
                break
        }
        newArr && observeArr(newArr)
    }
})
export {arrMethods}

